public class Admin {

    public String name;
    public String password;

    public Admin(String name, String password) {
        this.name = name;
        this.password = password;
    }
    //登录方法
    public  void login(String name,String password) {
        if (!(this.name.equals(name))) {
            throw new NameException("用户名错误");
        }
        else if(!(this.password.equals(password))){
            throw new PasswordException("密码错误");
        }
        else{
            System.out.println("登录成功");
        }
    }
}
